package com.itzzj.common.global;

import com.itzzj.common.enums.ResultCode;
import com.itzzj.common.response.Result;
import com.itzzj.common.response.ResultResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public Result exceptionHandler(HttpServletRequest request, Exception ex){
        // TODO 获取详细的错误信息，进行返回
        return ResultResponse.failure(ResultCode.INTERNAL_SERVER_ERROR);
    }
}
